package com.whiteape.book.model.dto;

import com.whiteape.book.utils.GsonUtils;

import org.greenrobot.greendao.converter.PropertyConverter;

import java.io.Serializable;

public class SiteSourceChapterInfoBean implements PropertyConverter<SiteSourceChapterInfoBean, String>, Serializable {
    /**
     * 章节列表规则，通过此规则拿到全部章节
     */
    private String list;

    /**
     * 某一章节的具体url (通过list指定的rule解析出来的章节中的一条，再从中提取url)
     */
    private String url;

    private String batchUrl;

    /**
     * 某一章节的名字
     */
    private String name;

    private Boolean orderAsc;

    @Override
    public SiteSourceChapterInfoBean convertToEntityProperty(String databaseValue) {
        return GsonUtils.string2Obj(databaseValue, SiteSourceChapterInfoBean.class);
    }

    @Override
    public String convertToDatabaseValue(SiteSourceChapterInfoBean entityProperty) {
        return GsonUtils.obj2String(entityProperty);
    }

    public String getBatchUrl() {
        return batchUrl;
    }

    public void setBatchUrl(String batchUrl) {
        this.batchUrl = batchUrl;
    }

    public String getList() {
        return list;
    }

    public void setList(String list) {
        this.list = list;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Boolean getOrderAsc() {
        return orderAsc;
    }

    public void setOrderAsc(Boolean orderAsc) {
        this.orderAsc = orderAsc;
    }

    @Override
    public String toString() {
        return "SiteSourceChapterInfoBean{" +
                "list='" + list + '\'' +
                ", url='" + url + '\'' +
                ", name='" + name + '\'' +
                ", orderAsc=" + orderAsc +
                '}';
    }
}
